﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace masini
{
    class Client
    {
        string name;
        int age;
        List<Car> cars;  //lista de masini a clientului

        public Client() { }

        public Client(string name, int age)
        {
            this.name = name;
            this.age = age;
            cars = new List<Car>();
        }

        public void addCar(Car c)
        {
            if (c.getName() != null)
            {
                cars.Add(c);
                Console.WriteLine("Tranzactie finalizata");
            }
            else
                Console.WriteLine("Eroare la completarea campurilor sau masina nu exista in pool! Reincercati!");
        }

        public int removeCar()
        {
            if (cars.Count == 0)
            {
                Console.WriteLine("Nu exista masini in lista pentru a fi sterse");
                return 0;
            }
            cars.RemoveAt(0);
            return 1;
        }

        public void printCars()
        {
            if (cars.Count == 0)
                Console.WriteLine(name + " nu detine nicio masina");
            else
            {
                Console.WriteLine(name + " detine urmatoarele masini: ");
                Console.WriteLine("Nume -- Tip -- Culoare -- Transmisie -- Dotari -- Motorizare -- Dimensiuni"); 
                foreach (Car c in cars)
                {
                    if (c.getName() != null)
                        c.print();
                       
                }
            }

        }
    }
}
